<extend name="Layout/index" />

<block name="breadcrumb-01">
	<li>
		<i class="icon-home home-icon"></i>
		<a href="#">首页</a>
	</li>
	<li class="active">首页管理</li>
</block>

<block name="breadcrumb-02">
	<h1>
		首页管理
		<small>
			<i class="icon-double-angle-right"></i>
			 轮播图添加
		</small>
	</h1>
</block>

<block name='main'>

	<form action="<{:U('Mindex/LBTDadd')}>" enctype="multipart/form-data" method="post" class='col-md-4' onsubmit="return checkHref()">
		
		<div class="form-group">
		<label for="#" class="">添加轮播图：</label>
		  <div class="input-group">
		  	 输入超链接<input id="href" onblur="checkHref()" type="text" name="href" class="form-control" aria-label="Amount (to the nearest dollar)">
		  	 <p id="utab" style="color:#999;">请输入http://或https://或ftp开头的有效链接</p>
		  	 <p style="height:10px;"></p>
		  	 输入图片alt<input type="text" name="alt" class="form-control" aria-label="Amount (to the nearest dollar)">
			<p></p>
			<input type="file" name="photo" class="btn btn-primary btn-default btn-lg">
 			<p></p>
  		  </div>
		  <span class="input-group-btn">
				<button  class="btn btn-success btn-sm">添加</button>
		  </span>
		</div>
	</form>
	
	<script>
		function checkHref(){
			var href = document.getElementById('href').value;
			var utab = document.getElementById('utab');
			utab.innerHTML = '格式不正确!';
			if(href.match("^\\s*((http(s)?://)|(ftp://)|())\\w+(\\.\\w+)+((:\\d{1,5})|)(/\\w*)*(/\\w+\\.(\\w+|))?([\\w- ./?％&=]*)?") ==null){
				utab.innerHTML = '格式不正确!';
				utab.style.color = '#f00';
                return false;
			} else{
				utab.innerHTML = '√验证通过!';
                utab.style.color = '#0a0';
                return true;
			}
		}
		
	</script>
</block>
